/*
 * @Author: your name
 * @Date: 2021-10-29 15:46:55
 * @LastEditTime: 2022-06-02 13:36:53
 * @LastEditors: 夏郑兴 971348024@qq.com
 * @Description: 用户分析
 */
import request from '@/utils/system/request'

/**
 * 管理员列表
 * offline_date_time string
 * online_date_time string
 * page integer
 * page_size  integer
 * project_id string
 * search_text string
 * status integer
 **/
export function getProjectList(data: any) {
  return request({
    url: '/admin/project/list',
    baseURL: '/api',
    method: 'post',
    data
  })
}


export function getOne(data: any) {
  return request({
    url: '/admin/project/getOne',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 批量导入通用接口处理
 * file
 **/
export function batchImportReq(data: any, formData: any) {
  return request({
    url: data.url,
    baseURL: '/api',
    method: 'post',
    data: formData
  })
}

/**
 * 删除项目
 * id
 */
export function delProject(data: any) {
  return request({
    url: '/admin/project/del',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 编辑项目状态
 * id
 * status
 */
export function changeProjectStatus(data: any) {
  return request({
    url: '/admin/project/status/edit',
    baseURL: '/api',
    method: 'post',
    data
  })
}
/**
 * 编辑项目状态
 * id
 * status
 */
export function changeProjectInfo(data: any) {
  return request({
    url: '/admin/project/info/edit',
    baseURL: '/api',
    method: 'post',
    data
  })
}

export function oldUserOpenOrClose(data: any) {
  return request({
    url: '/admin/project/excel/old_user_open_or_close',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function newUserOpenOrClose(data: any) {
  return request({
    url: '/admin/project/excel/new_user_open_or_close',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 上传项目封面
 * id
 * file
 */
export function uploadProjectImg(data: any) {
  return request({
    url: `/admin/project/cover/upload/${data.id}`,
    baseURL: '/api',
    method: 'post',
    data: data.data
  })
}
export function delProjectImg(data: any) {
  return request({
    url: `/admin/project/cover/del/${data.id}`,
    baseURL: '/api',
    method: 'post',
    data: data.data
  })
}

/**
 * 上传banner封面
 * id
 * file
 */
export function uploadProjectImgBanner(data: any) {
  return request({
    url: `/admin/project/banner/upload/${data.id}`,
    baseURL: '/api',
    method: 'post',
    data: data.data
  })
}
export function delProjectImgBanner(data: any) {
  return request({
    url: `/admin/project/banner/del/${data.id}`,
    baseURL: '/api',
    method: 'post',
    data: data.data
  })
}


/**
 * 题目列表
 * effective_time array[string] 题目生效时间
 * end_date_time array[string] 截止时间
 * finish_time array[string] 完成时间
 * page integer
 * page_size integer
 * status integer 状态 0 未生效 1已完成 2 已领取 3指派中 4返修中 5 闲置中 6 已作废
 * team_number string 团队编号
 * title string
 * topic_id string
 */
export function getTopicList(data: any) {
  return request({
    url: `/admin/topic/list`,
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 题目详情
 * id
 */
export function getTopicDetail(data: any) {
  return request({
    url: `/admin/topic/${data.id}`,
    baseURL: '/api',
    method: 'get',
  })
}


/**
 * 删除题目
 * id
 */
export function delTopic(data: any) {
  return request({
    url: `/admin/topic/del`,
    baseURL: '/api',
    method: 'post',
    data
  })
}


/**
 * 新增题目配置
 * answer_type integer 题目作答类型 0 文本框 1 上传文件
 * is_check integer 上传文件是否校验名称 0不校验 1 校验
 * required integer 是否必填 0 选填 1必填
 * system_topic_id integer 关联的题目Id
 * title string 表单标题
 * tooltip string 提示文本
 * topic_id string 用户自定义的题目Id
 */
export function createdTopicConfig(data: any) {
  return request({
    url: `/admin/topic/configuration/created`,
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 编辑题目配置
 * answer_type integer 题目作答类型 0 文本框 1 上传文件
 * id integer
 * is_check integer 上传文件是否校验名称 0不校验 1 校验
 * required integer
 * TopicId string `json:"topic_id"` //用户自定义的题目Id
 * tooltip string 提示文本
 */
export function editTopicConfig(data: any) {
  return request({
    url: `/admin/topic/configuration/edit`,
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 删除题目配置
 * id
 */
export function delTopicConfig(data: any) {
  return request({
    url: `/admin/topic/configuration/del`,
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 新建题目备注
 * content string 题目备注文本
 * sn integer 序号
 * system_topic_id integer 题目数据库Id
 * topic_id string 题目自定义 Id
 */
export function createTopicNote(data: any) {
  return request({
    url: `/admin/topic/note/created`,
    baseURL: '/api',
    method: 'post',
    data
  })
}
/**
 * 编辑题目备注
 * content string 题目备注文本
 * sn integer 序号
 * id
 */
export function editTopicNote(data: any) {
  return request({
    url: `/admin/topic/note/edit`,
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 删除题目备注
 * id
 */
export function delTopicNote(data: any) {
  return request({
    url: `/admin/topic/note/del`,
    baseURL: '/api',
    method: 'post',
    data
  })
}



/**
 * 项目提示配置
 * id
 * content
 */
export function editProjectHint(data: any) {
  return request({
    url: `/admin/project/hint/edit`,
    baseURL: '/api',
    method: 'post',
    data
  })
}


/**
 * 批量清空当前题目上传的答案
 * 1:批量清空当前题目上传的答案；释放空间
 * project_id string
 * topic_ids array[string]
 */
export function batchClearUploadData(data: any) {
  return request({
    url: '/admin/topic/batch_clear_upload_data',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 批量清空当前题目上传的答案
 * 批量删除当前题目；释放空间
 * ids
 */
export function batchDelTopicData(data: any) {
  return request({
    url: '/admin/topic/batch_del',
    baseURL: '/api',
    method: 'post',
    data
  })
}


/**
 * 更新题目状态: 回归题库，返修，作废
 * id integer
 * status integer
 */
export function changeTopicStatus(data: any) {
  return request({
    url: '/admin/topic/change_status',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 导出通用接口
 * topic_ids array[interger]
 * project_ids array[string]
 */
export function exportExcel(data: any) {
  return request({
    url: '/admin/topic/answer/excel/export',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function exportAnswer(data: any) {
  return request({
    url: '/admin/topic/answer/excel/export_answer',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function exportAudit(data: any) {
  return request({
    url: '/admin/topic/answer/excel/export_audit',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function projectExport0(data: any) {
  return request({
    url: '/admin/project/excel/exports0',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function projectExport1(data: any) {
  return request({
    url: '/admin/project/excel/exports1',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function projectExport2(data: any) {
  return request({
    url: '/admin/project/excel/exports2',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function exportAllExcel(data: any) {
  return request({
    url: '/admin/project/answer/excel/export_all',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function exportTopicAllExcel(data: any) {
  return request({
    url: '/admin/topic/answer/excel/export_all',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function topicUserRecordList(data: any) {
  return request({
    url: '/admin/topic/topic_user_record_list',
    baseURL: '/api',
    method: 'post',
    data
  })
}
